class Platform {
    VERSION: string = "1.0.0.6200"; // 版本号
    CHANNEL: number = 2; // 渠道号 1.ios企业包  2.android官网  3.android应用宝  4.appStore包
    PLATFORM: number = 1; // 发行公司 1.718棋牌
    REGFROM: number = 0; // 用户注册来源 暂未启用
    referrer: string = ""; // 来源 “bw575.cn”（邀请码）
    promocode: string = ""; //推广码
    DEBUG_TYPE: number = 0; // 0.测试  1.正式

    setChanel(data) {
        var _channel = "";
        var _referrer = ""; //邀请码
        var _promocode = ""; //推广码
        if (data) {
            try {
                var _data = JSON.parse(data);
                if (typeof _data == "object" && _data) {
                    if (/^[0-9]+$/.test(_data.rid)) {
                        _channel = parseInt(_data.rid) + "";
                    } else {
                        _channel = 0 + "";
                    }
                    _referrer = _data.rid || "";
                    _promocode = _data.code || "";
                }
            } catch (e) { }
        }
        //
        if (!_channel) {
            _channel = cc.vv.GLCusStorage.getItem("parentrid");
        } else {
            cc.vv.GLCusStorage.setItem("parentrid", _channel);
        }

        console.log("___________________channel 11= " + _channel);
        if (!_channel) {
            _channel = 0 + "";
            _referrer = "";
        }
        this.CHANNEL = parseInt(_channel + "");

        console.log("___________________referrer = " + _referrer);
        this.referrer = _referrer;
        this.promocode = _promocode;
    }
}
export let platform: Platform = new Platform();
